<?php
/**
 * @description
 *  文章详细页面
 *
 * filename : /admin/modules/content/views/content_data_view.php
 * date     : 2009-2-2 18:01
 * author   : hotgun
 * email    : hotgun@163.com
 * 
 * (c)copyright hotgun
 *
 * $Id: /admin/modules/content/views/content_data_view.php,v 1.0 2009-2-2 18:01 $
 */

// 取得返回字符串
$back_url   = strcode(getcookie('back_url'), 'DECODE');
if($back_url == '') $back_url   = $mod_url['li'];


// 处理字符串防止特殊符号引起的错误，
$process_include    = array('article_title', 'sub_title', 'keywords', 'url', 'brief', 'come_from', 'author', 'outer_url', 'hits',
    'seo_title', 'seo_keywords', 'seo_description'
    );
string_pre_process($viewvar, $process_include);

// 如果分类cid未指定，默认分类id为栏目id
if($viewvar['cid'] <= 0) $viewvar['cid'] = $cata;
if($viewvar['cata_order'] >= $G_big_integer || $viewvar['cata_order'] <= 0) $viewvar['cata_order'] = '';
// 创建时间
$viewvar['createtime'] = date(DATE_TIME_FORMAT, $viewvar['createtime']);
// 发布时间

$viewvar['pub_date']    = date(DATE_FORMAT, $viewvar['pub_date']);

// 审核时间
$viewvar['chk_time']    = date(DATE_TIME_FORMAT, $viewvar['chk_time']);

if($_REQUEST['action']!="add")
$chk_display= $viewvar['display'] == 1 ? ' checked' : '';
else
$chk_display='checked';


$chk_flag= $viewvar['flag'] == 1 ? ' checked' : '';


// 顶
$chk_top    = $viewvar['top'] == 1 ? 'checked' : '';
$chk_guapai    = $viewvar['guapai'] == 1 ? 'checked' : '';

// 附标题
$style_sub_title= 'display:none;';
$chk_sub_title  = '';
if($viewvar['sub_title'] != '') {
    $style_sub_title= 'display:block;';
    $chk_sub_title  = ' checked';
}
// 跳转地址
$style_url  = 'display:none;';
$chk_is_url = '';
if(($viewvar['flag'] & 16) == 16 && $viewvar['url'] != '') {
    if($viewvar['url'] != '') $style_url  = 'display:block;';
    else $viewvar['flag'] = $viewvar['flag']^16;
}
// 附件跳转地址
$style_outeratt = 'display:none;';
$chk_outeratt   = '';
if($viewvar['outeratt'] != '') {
    $style_outeratt = 'display:block;';
    $chk_outeratt   = 'checked';
}

$cata_keylang='名录';
if($action == 'modify') {
    $txt_form_title = '修改' . $cata_keylang;
} else {
    $txt_form_title = '新增' . $cata_keylang;
}


if(empty($chk_realname))
    $lab_chk_realname = '<font style=\"color:red\">未审核</font>';
else
    $lab_chk_realname = $chk_realname;


require($abs_admin_cppath . '/header.php');
?>
<link rel="stylesheet" rev="stylesheet" href="<?php echo $url_global['common']; ?>/css/win.css" type="text/css" media="all">
<link rel="stylesheet" href="<?php echo $url_global['common']; ?>/kindeditor/themes/default/default.css" />
<link rel="stylesheet" href="<?php echo $url_global['common']; ?>/kindeditor/plugins/code/prettify.css" />
<script charset="utf-8" src="<?php echo $url_global['common']; ?>/kindeditor/kindeditor.js"></script>
<script charset="utf-8" src="<?php echo $url_global['common']; ?>/kindeditor/lang/zh_CN.js"></script>
<script charset="utf-8" src="<?php echo $url_global['common']; ?>/kindeditor/plugins/code/prettify.js"></script>
<script>
	KindEditor.ready(function(K) {
		var editor1 = K.create('textarea[id="content"]', {
			cssPath : '<?php echo $url_global['common']; ?>/kindeditor/plugins/code/prettify.css',
			uploadJson : '<?php echo $url_global['common']; ?>/kindeditor/php/upload_json.php',
			fileManagerJson : '<?php echo $url_global['common']; ?>/kindeditor/php/file_manager_json.php',
			allowFileManager : true,
			afterCreate : function() {
				var self = this;
				K.ctrl(document, 13, function() {
					self.sync();
					K('form[name=example]')[0].submit();
				});
				K.ctrl(self.edit.doc, 13, function() {
					self.sync();
					K('form[name=example]')[0].submit();
				});
			}
		});
		prettyPrint();
	});
</script>

<SCRIPT LANGUAGE="JavaScript" SRC="<?php echo $url_global['common']; ?>/js/win.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="<?php echo $url_global['common']; ?>/js/Validator.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="<?php echo $url_global['common']; ?>/js/popcalendar.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="<?php echo $url_global['common']; ?>/js/jquery-1.3.2.min.js"></SCRIPT>
<script src="<?php echo $url_global['common']; ?>/js/My97DatePicker/WdatePicker.js"></script>

		<div class="datacontainer2" style="width:90%;">
<div class="header">
<?php echo $txt_form_title ?>
</div>
<form action="<?php echo $mod_url['save'] ?>" method="post" name="article_data" enctype="multipart/form-data" onsubmit="return Validator.Validate(this,3);">
<table BORDER="0" cellpadding="0" cellspacing="0" width="100%" class="list_table">

<TR>
	<TD width="80" align="right" class="caption">企业名称</TD>
	<TD class="cell" colspan="3">
		<input type="text" name="article[name]" id="article_title" value="<?php echo $viewvar['name']; ?>" class="text" style="width:440px;color:<?php echo $viewvar['tcolor'];?>"

		dataType="Require" dataType="Limit" min="1" max="255" msg="标题必须填写且必须符合上述规则">
		<span class="mustfill">*</span>
	</TD>
</TR>

<TR>
	<TD colspan="4" class="cell graycell">
<?php
//编辑器
/*require($G_abs_common . '/fckeditor/fckeditor.php');
$oFCKeditor             = new FCKeditor('article[content]') ;
$oFCKeditor->BasePath   = $G_web_common . '/fckeditor/';
$oFCKeditor->UpPath     = '/upload/site/';
$oFCKeditor->Value      = $viewvar['content'];
$oFCKeditor->Width      = '100%';
$oFCKeditor->Height     = 400;
$FCKeditHtml            = $oFCKeditor->CreateHtml() ;
echo $FCKeditHtml;*/
?>
<textarea name="article[content]" id="content" style="width:700px;height:400px;visibility:hidden;"><?php echo htmlspecialchars($viewvar['content']); ?></textarea>
	</TD>
</TR>
<TR>
	<TD width="80" align="right" class="caption">企业缩略图片</TD>
	<TD class="cell" colspan="2" valign="top" align="left">


<?php
$viewvar['small_image'] = get_upfile_url($viewvar['small_image'], $url_global['common'] . '/images/nopic.jpg');//'common' -> 'admin_theme'
echo get_html_img_record($viewvar['small_images'], 'small_image');
?>
<INPUT TYPE="checkbox" NAME="article[makethumb]" ID="makethumb" VALUE="1" > <label for="makethumb">生成缩略图</label>
宽<input type="text" name="article[makethumbwidth]" value="120" class="text" size="1">X 高<input type="text" name="article[makethumbheight]" value="90" class="text" size="1">
<div class="hint">
	<!-- 考虑到图片变形的因素，请尽量按 <font color="red">245 * 186</font> 的图片或相近比例上传图片！ -->
</div>
	</TD>
	<TD align="left" valign="middle"><img id="obj_small_image" src="<?php echo $viewvar['small_image']; ?>" width="120" height="90"></TD>
</TR>
<TR>
	<TD width="80" align="right" class="caption">发布时间</TD>
	<TD class="cell" title="格式：年-月-日" width="260">

	<input type="text" onClick="WdatePicker({dateFmt:'yyyy-M-d'});" readonly="true" name="article[pub_time]" id="pub_date" value="<?php echo date('Y-m-d',$viewvar['pub_time']); ?>" class="text" size="12" style="font-size:10px">

	</TD>
	<TD width="80">&nbsp;</TD>
	<TD></TD>
</TR>
<TR><input type="hidden" name="article[uid]" value="0" />
	<TD width="80" align="right" class="caption">审核</TD>
	<TD class="cell" width="260">
		<label for="valid">审核</label><input type="checkbox" name="article[display]" id="display" value="1" <?php echo $chk_display?> <?php if(!is_su()) echo "disabled=disabled"; ?>> 
	</TD>
	<TD width="80">&nbsp;</TD>
	<TD></TD>
</TR>
<TR>
	<TD width="80" align="right" class="caption">推荐</TD>
	<TD class="cell" width="260">
		<label for="validq">推荐</label><input type="checkbox" name="article[flag]" id="flag" value="1" <?php echo $chk_flag?>> 
	</TD>
	<TD width="80">&nbsp;</TD>
	<TD></TD>
</TR>
<TR>
	<TD class="submit" colspan="4" align="center">
		<input type="submit" value=" 保存 " class="btn">
		<input type="reset" value=" 重置 " class="btn">
		<input type="button" value=" 返回 " class="btn" onclick="location.href='<?php echo $back_url; ?>'">
		<input type="hidden" name="save" value="<?php echo $save_flag; ?>">
        <input type="hidden" name="article[id]" value="<?php echo $viewvar['id']; ?>">
	</TD>
</TR>
</TABLE>
</form>
		</div>
<?php
echo_html_img_js()
?>
<?php
require($abs_admin_cppath . '/footer.php');
?>